In [1]:
# Play with Starfish BTSETTL Grids:

In [7]:
import numpy as np

import Starfish
#from Starfish.grid_tools import PHOENIXGridInterfaceNoAlpha as PHOENIX
from Starfish.grid_tools import HDF5Creator, Instrument

from Starfish.grid_tools import BTSettlGridInterface as BTSETTL

In [8]:
class CRIRES_50k(Instrument):
    '''CRIRES instrument at R=50000.'''
    fwhm = 299792.458 / 50000     # fwhm = c / R
    # Full crires wavelength range=(9500, 53800)
    def __init__(self, name="CRIRES", FWHM=fwhm, wl_range=Starfish.grid["wl_range"]):
        super().__init__(name=name, FWHM=FWHM, wl_range=wl_range)
        # Sets the FWHM and wl_range

In [10]:
mygrid = BTSETTL(norm=False, air=False, base=Starfish.grid["btsettle_raw"])    # Disable normalization to solar boloametic flux.
instrument = CRIRES_50k()
# HDF5Creator(GridInterface, filename, Instrument, ranges=None, key_name='t{0:.0f}g{1:.1f}', vsinis=None)
# Specify hdf5_path in config.yaml file.
creator = HDF5Creator(mygrid, Starfish.grid["btsettl_hdf5_path"], instrument, ranges=Starfish.grid["parrange"])




# Need to change starfish BT-SETTL to change how it handles param_names and points

# Might need own interface as there is hardcoded folder CXXXX2011


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-10-03485bee2c85> in <module>()
----> 1 mygrid = BTSETTL(norm=False, air=False, base=Starfish.grid["btsettle_raw"])    # Disable normalization to solar boloametic flux.
      2 instrument = CRIRES_50k()
      3 # HDF5Creator(GridInterface, filename, Instrument, ranges=None, key_name='t{0:.0f}g{1:.1f}', vsinis=None)
      4 # Specify hdf5_path in config.yaml file.
      5 creator = HDF5Creator(mygrid, Starfish.grid["btsettl_hdf5_path"], instrument, ranges=Starfish.grid["parrange"])

~/Phd/Codes/Repos/Starfish/Starfish/grid_tools.py in __init__(self, air, norm, wl_range, base)
    402                 "Z":np.arange(-0.5, 0.6, 0.5),
    403                 "alpha": np.array([0.0])},
--> 404         air=air, wl_range=wl_range, base=base)
    405 
    406         self.norm = norm #Normalize to 1 solar luminosity?

TypeError: __init__() missing 1 required positional argument: 'param_names'

In [11]:
creator.process_grid()


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-11-c03085d8abff> in <module>()
----> 1 creator.process_grid()

NameError: name 'creator' is not defined

Loading BTSETTL Directly


In [6]:
from Starfish.grid_tools import load_BTSettl
load_BTSettl(2200, 4.5, 0.0)


---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-6-efbbf56178e9> in <module>()
      1 from Starfish.grid_tools import load_BTSettl
----> 2 load_BTSettl(2200, 4.5, 0.0)

~/Phd/Codes/Repos/Starfish/Starfish/grid_tools.py in load_BTSettl(temp, logg, Z, norm, trunc, air)
   1252 def load_BTSettl(temp, logg, Z, norm=False, trunc=False, air=False):
   1253     rname = "BT-Settl/CIFIST2011/M{Z:}/lte{temp:0>3.0f}-{logg:.1f}{Z:}.BT-Settl.spec.7.bz2".format(temp=0.01 * temp, logg=logg, Z=Z)
-> 1254     file = bz2.BZ2File(rname, 'r')
   1255 
   1256     lines = file.readlines()

~/anaconda3/envs/sims/lib/python3.6/bz2.py in __init__(self, filename, mode, buffering, compresslevel)
     94 
     95         if isinstance(filename, (str, bytes, os.PathLike)):
---> 96             self._fp = _builtin_open(filename, mode)
     97             self._closefp = True
     98             self._mode = mode_code

FileNotFoundError: [Errno 2] No such file or directory: 'BT-Settl/CIFIST2011/M0.0/lte022-4.50.0.BT-Settl.spec.7.bz2'

In [ ]: